import { request } from '@/utils/request'

import type { BatchReqData, BatchRes, BatchTicketCheckPageReqParams, BatchTicketCheckRes, BatchTicketPageReqParams, BatchTicketRes } from './model/batch'
import type { PageResult } from './model/common'

export function getBatchPageList(page = 1, size = 15) {
  return request.get<PageResult<BatchRes>>({ url: `/v1/batchOrder/page`, params: { page, size } })
}

export function getBatchDetail(id: string) {
  return request.get<BatchRes>({ url: `/v1/batchOrder`, params: { id } })
}

export function createBatch(data: BatchReqData) {
  return request.post<BatchRes>({ url: `/v1/save/batchOrder`, data })
}

export function getBatchTicketCheckPageList(params: BatchTicketCheckPageReqParams) {
  return request.get<PageResult<BatchTicketCheckRes>>({ url: `/v1/checkFlow/page`, params })
}

export function getBatchTicketCheckDetail(id: string) {
  return request.get<BatchTicketCheckRes>({ url: `/v1/checkFlow`, params: { id } })
}

export function getBatchTicketPageList(params: BatchTicketPageReqParams) {
  return request.get<PageResult<BatchTicketRes>>({ url: `/v1/batchTicketPool/page`, params })
}
